package priv.pattern.compositemode.service.impl;

import priv.pattern.compositemode.service.BaseShape;

import java.awt.*;

/*
 * 作者：m鹏h
 * 时间；2024/8/5 18:01
 * 描述：三角形
 **/
public class Rectangle extends BaseShape {
 public int width;
 public int height;

 public Rectangle(int x, int y, int width, int height, Color color) {
  super(x, y, color);
  this.width = width;
  this.height = height;
 }

 @Override
 public int getWidth() {
  return width;
 }

 @Override
 public int getHeight() {
  return height;
 }

 @Override
 public void paint(Graphics graphics) {
  super.paint(graphics);
  graphics.drawRect(x, y, getWidth() - 1, getHeight() - 1);
 }
}
